package org.dolphin.base.id.transformer;

import java.util.UUID;
import org.hibernate.type.descriptor.java.UUIDTypeDescriptor.ValueTransformer;

public class CustomToStringTransformer implements ValueTransformer {
  public static final CustomToStringTransformer INSTANCE = new CustomToStringTransformer();

  @Override
  public UUID parse(Object value) {
    return UUID.fromString((String) value);
  }

  @Override
  public String transform(UUID uuid) {
    String value = uuid.toString();
    value = value.replaceAll("-", "").toUpperCase();
    return value;
  }
}
